*----------------------------------------------------------------------*
* 程序的事务代码: ZFIU022
* 程序名称:  更改发票结算单状态为草稿或作废-管理员使用
* 作者       :  王鹏
* 时间        : 20241030
* 模块      : FI
* 负责人 :
* 描述 :
*
*
*
* 特殊特性:
*
*
*----------------------------------------------------------------------*
* 修改记录:
*作者      时间      描述
*-----------  --------  -----------------------------------------------*
*
*----------------------------------------------------------------------*
REPORT ZFIU022.
TABLES:ZFIT079_HEAD.



PARAMETERS:
  P_JSDDH TYPE ZFIT079_HEAD-JSDDH.

SELECTION-SCREEN BEGIN OF LINE .

  PARAMETERS P_VALID RADIOBUTTON GROUP R1 DEFAULT 'X' USER-COMMAND UCOMM1.
  SELECTION-SCREEN COMMENT 3(15) FOR FIELD P_VALID.

  PARAMETERS P_DRAFT   RADIOBUTTON GROUP R1.
  SELECTION-SCREEN COMMENT 20(15) FOR FIELD P_DRAFT.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

AT SELECTION-SCREEN.

START-OF-SELECTION.
  PERFORM FRM_PROCESS_DATA.

END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form frm_process_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_PROCESS_DATA .
  DATA:
    LV_JSDZT TYPE ZFIT079_HEAD-JSDZT.

  IF P_JSDDH IS NOT INITIAL.
    SELECT SINGLE *
       INTO ZFIT079_HEAD
       FROM ZFIT079_HEAD
      WHERE JSDDH = P_JSDDH.
    IF SY-SUBRC <> 0.
      MESSAGE '未找到该发票结算单'(M01) TYPE 'S' DISPLAY LIKE 'E'.
      LEAVE LIST-PROCESSING.

    ELSE.
      IF P_VALID IS NOT INITIAL.
        LV_JSDZT = '04'.
      ELSE.
        LV_JSDZT = '01'.
      ENDIF.

      UPDATE ZFIT079_HEAD SET JSDZT = LV_JSDZT WHERE JSDDH = P_JSDDH.

      COMMIT WORK AND WAIT.
      MESSAGE '该发票结算单状态已成功更新'(M02) TYPE 'I'.

    ENDIF.
  ENDIF.
ENDFORM.
